package com.polaris.live.viewmodel.backpack

import androidx.lifecycle.MutableLiveData
import com.polaris.live.common.mvvm.viewmodel.BaseViewModel
import com.polaris.live.common.network.request
import com.polaris.live.common.network.requestLoading
import com.polaris.live.common.network.state.ResultState
import com.polaris.live.net.userService
import com.polaris.live.resp.back_resp.UserBackpackNumberResp
import com.polaris.live.resp.go_resp.UseNumberRequest

/**
 * BackPackNumberViewModel 背包Model
 *
 * @author Created by 天晴 on 2024/1/17 9:15
 * @since 1.0.0
 **/
class BackPackNumberViewModel : BaseViewModel() {

    //获取用户的number列表
    val mNumberLiveData = MutableLiveData<ResultState<List<UserBackpackNumberResp>>>()
    fun getNumberList() {
        request({ userService.getNumberList() }, mNumberLiveData)
    }

    //使用靓号
    val mUseNumberLiveData = MutableLiveData<ResultState<Any>>()
    fun useNumber(userNumber: Long, useStatus: Long) {
        val useDressUp = UseNumberRequest(userNumber, useStatus)
        requestLoading({ userService.useNumber(useDressUp) }, mUseNumberLiveData, waitTime = 0)
    }
}